package com.sasken.pdb.controllers.events
{
	import flash.events.Event;
	
	import mx.controls.advancedDataGridClasses.AdvancedDataGridColumn;

	/**
	 *  FilterEvent is dispatched by custom header renderers that contain filters.
	 *  The event contains the text used for filtering as well as the column it was dispatched from.
	 */ 
	public class FilterEvent extends Event
	{	
		/**
		 * A standard filter event dispatched when text is written to the filter field.
		 */ 
		public static var FILTER_EVENT:String = "filterEvent";
		
		/**
		 *  An event which requests the dataprovider of AdvancedDataGrid to be refresh():ed. 
		 *  Kept separate from FILTER_EVENT so that multiple changes could be made before 
		 *  refreshing. 
		 */ 
		public static var FILTER_REFRESH_EVENT:String = "filterRefreshEvent";
		
		private var _filterText:String;
		private var _column:AdvancedDataGridColumn;
		
		/**
		 *  Constructor. 
		 *  @param type The type of the event.
		 *  @param filterText The text being sent as a filter.
		 *  @param column The column being filtered.
		 */ 
		public function FilterEvent(type:String, filterText:String, column:AdvancedDataGridColumn,
									bubbles:Boolean=false, cancelable:Boolean=false)
		{
			super(type, bubbles, cancelable);
			_filterText = filterText;
			_column = column;
		}
		
		public function get filterText():String
		{
			return _filterText;
		}
		
		public function get column():AdvancedDataGridColumn
		{
			return _column;
		}
		
	}
}